/*	
	stencil - action script 3 isometric game engine.

	http://code.google.com/p/stencilas3/
	
	Copyright (c) 2010 Max Zhuravkov, All Rights Reserved.

	Permission is hereby granted, free of charge, to any person obtaining a copy of
	this software and associated documentation files (the "Software"), to deal in
	the Software without restriction, including without limitation the rights to
	use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
	of the Software, and to permit persons to whom the Software is furnished to do
	so, subject to the following conditions:

	The above copyright notice and this permission notice shall be included in all
	copies or substantial portions of the Software.

	THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
	IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
	FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
	AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
	LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
	OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
	SOFTWARE.
*/
package stencil.core.engine.display.styles {
	
	import flash.display.Graphics;
	import stencil.core.engine.display.ILineStyle;
	
	/**
	 * Applies the same line style as flash.display.Graphics#lineStyle does.
	 * 
	 * @author Max Zhuravkov
	 */
	public class SimpleLineStyle implements ILineStyle {
		
		private var _color:uint = 0;
		
		private var _thickness:Number;
		
		private var _alpha:Number
		
		private var _pixelHinding:Boolean;
		
		private var _scaleMode:String;
		
		private var _caps:String;
		
		private var _joints:String;
		
		private var _miterLimit:Number;
		
		//----------------------------------------------------------------
		// Constructor
		//----------------------------------------------------------------
		
		public function SimpleLineStyle(color:uint = 0x000000, thickness:Number = 1, alpha:Number = 1, pixelHinding:Boolean = false, scaleMode:String = "normal", caps:String = null, joints:String = null, miterLimit:int = 3) {
			this.color = color;
			this.thickness = thickness;
			this.alpha = alpha;
			this.pixelHinding = pixelHinding;
			this.scaleMode = scaleMode;
			this.caps = caps;
			this.joints = joints;
			this.miterLimit = miterLimit;
		}
		
		//----------------------------------------------------------------
		// Public properties
		//----------------------------------------------------------------
		
		/**
		 * 
		 */
		public function set color(value:uint):void {
			this._color = value;
		}
		
		public function get color():uint { 
			return _color; 
		}
		
		/**
		 * 
		 */
		public function set thickness(value:Number):void {
			this._thickness = value;
		}
		
		public function get thickness():Number { 
			return _thickness; 
		}
		
		/**
		 * 
		 */
		public function set alpha(value:Number):void {
			this._alpha = value;
		}
		
		public function get alpha():Number { 
			return _alpha; 
		}
		
		/**
		 * 
		 */
		public function set pixelHinding(value:Boolean):void 
		{
			this._pixelHinding = value;
		}
		
		public function get pixelHinding():Boolean { 
			return this._pixelHinding; 
		}
		
		/**
		 * 
		 */
		public function set scaleMode(value:String):void  {
			this._scaleMode = value;
		}
		
		public function get scaleMode():String { 
			return _scaleMode; 
		}
		
		/**
		 * 
		 */
		public function set caps(value:String):void {
			this._caps = value;
		}
		
		public function get caps():String { 
			return _caps; 
		}
		
		/**
		 * 
		 */
		public function set joints(value:String):void {
			this._joints = value;
		}
		
		public function get joints():String { 
			return _joints; 
		}
		
		public function get miterLimit():Number { 
			return _miterLimit; 
		}
		
		/**
		 * 
		 */
		public function set miterLimit(value:Number):void {
			this._miterLimit = value;
		}
		
		//----------------------------------------------------------------
		// Public methods
		//----------------------------------------------------------------
		
		/**
		 * @inheritDoc
		 */
		public function applyLineStyle(g:Graphics):void {
			
			g.lineStyle(this.thickness,this.color,this.alpha,this.pixelHinding,this.scaleMode,this.caps,this.joints,this.miterLimit)
		}
		
	}

}